<%@ page import="com.generalynx.common.resources.Resources"%>
<%@ include file="/WEB-INF/jsp/includes.jsp" %>

<script>
    function submitForm(action, id, className) {
        var fm = document.forms.adeForm;
        fm.action.value = action;
        fm.id.value = id;
        fm.className.value = className;
        fm.submit();
        return true;
    }

    function deleteX(action, id, name)  {
        if (confirm('<%=Resources.getString(Resources.DELETE)%> ' + name + ' ?'))    {
            return submitForm(action, id, 'foo.Bar');
        }
        else return false;
    }

    function jump(identifier) {
        var fm = document.forms.adeForm;
        fm.action.value = 'jump';
        fm.identifier.value = identifier;
        fm.submit();
        return true;
    }
</script>

<c:forEach items="${subClasses}" var="sc">
    <a href="#" onclick="return submitForm('add', 0, '<c:out value="${sc.class.name}"/>');" >>> <spring:message code="add" /> <c:out value="${sc.addLabel}"/></a><br/>
</c:forEach>
<p/>
<form method="POST" name="adeForm" >

    <input type="hidden" name="action" />
    <input type="hidden" name="id" />
    <input type="hidden" name="className" />
    <input type="hidden" name="identifier" value="<c:out value="${ps.currentIdentifier}"/>" />

    <c:if test="${!ps.first}">
        <a href="#" onclick="return jump(<c:out value="${ps.previousIdentifier}"/>);"><< </a>
    </c:if>
    <c:out value="${ps.taskbar}" escapeXml="false" />
    <c:if test="${!ps.last}">
        <a href="#" onclick="return jump(<c:out value="${ps.nextIdentifier}"/>);"> >></a>
    </c:if>

    <p/>

    <table>
        <c:forEach items="${list}" var="data" varStatus="status" >
            <c:out value="${data.adeLabel}" escapeXml="false" />
        </c:forEach>
    </table>

    <p/>

    <c:if test="${!ps.first}">
        <a href="#" onclick="return jump(<c:out value="${ps.previousIdentifier}"/>);"><< </a>
    </c:if>
    <c:out value="${ps.taskbar}" escapeXml="false" />
    <c:if test="${!ps.last}">
        <a href="#" onclick="return jump(<c:out value="${ps.nextIdentifier}"/>);"> >></a>
    </c:if>

</form>
